<?php
namespace ITSociaal\Themes\HuisVanHerstel;

use Timber as Lumber;
use Timber\URLHelper;
use Timber\Helper;
use Timber\Request;
use Timber\User;

class Timber extends Lumber
{
	/**
	 * @codeCoverageIgnore
	 */
	public static function get_context() {
		if ( empty(static::$context_cache) ) {
			static::$context_cache["http_host"] =
				URLHelper::get_scheme() . "://" . URLHelper::get_host();
			static::$context_cache["wp_title"] =
				@Helper::function_wrapper("wp_get_document_title");
			static::$context_cache["wp_head"] = @Helper::function_wrapper("wp_head");
			static::$context_cache["wp_footer"] = @Helper::function_wrapper("wp_footer");
			static::$context_cache["body_class"] = implode(" ", get_body_class());

			static::$context_cache["request"] = new Request();
			$user = new User();
			static::$context_cache["user"] = ($user->ID) ? $user : false;

			static::$context_cache["posts"] = static::query_posts();

			static::$context_cache = apply_filters("timber_context", static::$context_cache);
			static::$context_cache = apply_filters("timber/context", static::$context_cache);
		}

		return static::$context_cache;
	}
}

/* vi:set ts=4 sw=4 noet: */
